﻿using MvcArchStarter.Core.Persistence;
using MvcArchStarter.Domain;
using MvcArchStarter.WebUI.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcArchStarter.WebUI.Controllers.PostsCommands
{
    public class GetBlogCommand : IGetCommand<Blog>
    {
        public IUnitOfWork UnitOfWork { get; set; }
        public int BlogId { get; set; }
        public Blog Execute()
        {
            return UnitOfWork.RepositoryOf<Blog>().FindWhere(_ => _.BlogID == BlogId).
                FirstOrDefault();
        }
    }
}